import requests
from config import url_cloud,headers_web

class LaboratoryLearningStatistics:
    def __int__(self):
        self.url = url_cloud
        self.headers = headers_web

    @classmethod
    def post_recordLearningDuration(cls,url_cloud: str,headers= headers_web, params= None, json= None,paramspath=None):
        '''
        summary:记录学生学习时长
        description:1.云课堂学生端
        :param url_cloud:
        :param headers:
        :param params:
        :param json:
        :param paramspath:
        :return:
        '''
        url = url_cloud + f"/teachinglaboratoryapi/v1/laboratorylearningstatistics/{paramspath}/recordlearningduration"
        r = requests.post(url=url, headers=headers, params=params,json=json)
        return r
    @classmethod
    def post_submitTestPaper(cls, url_cloud: str, headers=headers_web, params=None, json=None, paramspath=None):
        '''
        summary:学生提交实验室准入试卷
        description:1.云课堂学生端
        :param url_cloud:
        :param headers:
        :param params:
        :param json:
        :param paramspath:
        :return:
        '''
        url = url_cloud + f"/teachinglaboratoryapi/v1/laboratorylearningstatistics/{paramspath}/testpaper"
        r = requests.post(url=url, headers=headers, params=params, json=json)
        return r

    @classmethod
    def get_learninginfos(cls, url_cloud: str, headers=headers_web, params=None, paramspath=None):
        '''
        summary:获取实验室项目学生学习情况
        description:1.云课堂学生端
        :param url_cloud:
        :param headers:
        :param params:
        :param json:
        :param paramspath:
        :return:
        '''
        url = url_cloud + f"/teachinglaboratoryapi/v1/laboratorylearningstatistics/{paramspath}/learninginfos"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def get_laboratoryadmittances(cls, url_cloud: str, headers=headers_web, params=None, paramspath=None):
        '''
        summary:获取实验室准入规则学生学习情况
        description:1.云课堂学生端
        :param url_cloud:
        :param headers:
        :param params:
        :param json:
        :param paramspath:
        :return:
        '''
        url = url_cloud + f"/teachinglaboratoryapi/v1/laboratorylearningstatistics/{paramspath}/laboratoryadmittances"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def get_viewGrades(cls, url_cloud: str, headers=headers_web, params=None, paramspath=None):
        '''
        summary:学生查看实验准入试卷成绩
        description:1.云课堂学生端
        :param url_cloud:
        :param headers:
        :param params:
        :param json:
        :param paramspath:
        :return:
        '''
        url = url_cloud + f"/teachinglaboratoryapi/v1/laboratorylearningstatistics/{paramspath}/testpaper"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def get_testPaper(cls, url_cloud: str, headers=headers_web, params=None):
        '''
        summary:获取实验室准入规则的试卷
        description:1.云课堂学生端
        :param url_cloud:
        :param headers:
        :param params:
        :param json:
        :param paramspath:
        :return:
        '''
        url = url_cloud + "/teachinglaboratoryapi/v1/laboratorylearningstatistics/testpaper"
        r = requests.get(url=url, headers=headers, params=params)
        return r